package com.demo.openpdfdemo.controller;

import com.demo.openpdfdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping(path = "/userPrint", method = RequestMethod.POST)
    @ResponseBody
    public void userPrint(HttpServletResponse response) {
        try {
            userService.printUserInfo(response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    @RequestMapping("/hello")
    public String index(){
        return "index";
    }
}
